import request from '@/utils/request'

// 查询期货结算单列表
export const getFutureSettlementList = (params) => {
  return request({
    url: '/kylin/futureSettlement/list',
    method: 'get',
    params: params
  })
}

// 查询期货结算单详情
export const getFutureSettlement = (id) => {
  return request({
    url: `/kylin/futureSettlement/${id}`,
    method: 'get'
  })
}

// 新增期货结算单
export const addFutureSettlement = (data) => {
  return request({
    url: '/kylin/futureSettlement/',
    method: 'post',
    data: data
  })
}

// 修改期货结算单
export const updateFutureSettlement = (id, data) => {
  return request({
    url: `/kylin/futureSettlement/${id}`,
    method: 'put',
    data: data
  })
}

// 删除期货结算单
export const delFutureSettlement = (data) => {
  return request({
    url: '/kylin/futureSettlement/',
    method: 'delete',
    data: data
  })
}

// 下载期货结算单
export const downloadFutureSettlement = (data) => {
  return request({
    url: '/kylin/futureSettlement/download',
    method: 'post',
    data: data,
    timeout: 60000 // 设置60秒超时，避免下载大文件时前台报超时
  })
}

// 导入期货结算单到资金日报
export const importSettlementToDaily = (data) => {
  return request({
    url: '/kylin/futureSettlement/importToDaily',
    method: 'post',
    data: data
  })
}

// 批量下载期货结算单
export const batchDownloadFutureSettlement = (data) => {
  return request({
    url: '/kylin/futureSettlement/batchDownload',
    method: 'post',
    data: data,
    timeout: 300000 // 设置5分钟超时，批量下载可能需要较长时间
  })
}